﻿<phone:PhoneApplicationPage 
    x:Class="wallstreet.Control_MyStocks_View"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:tool="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <UserControl.Resources>
        <Style x:Key="PanoramaTextBlock" TargetType="TextBlock">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="40"/>
        </Style>

        <Style x:Key="PanoramaTextListBox" TargetType="ListBox">
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem">
                                    <TextBlock Text="{Binding Name}"
                                               Style="{StaticResource PanoramaTextBlock}"/>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Image x:Name="imgBackground" Source="SplashScreenImage3.jpg" Height="800" Width="500" VerticalAlignment="Top" HorizontalAlignment="Left" />

        <controls:Pivot Title="" Margin="0,40,0,0" Foreground="White">

            <controls:PivotItem Header="stock" Foreground="White">
                <ListBox x:Name="lboStock" HorizontalAlignment="Left" SelectionChanged="lboNews_SelectionChanged" >
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{ Binding Type}" Style="{StaticResource PanoramaTextBlock}" Foreground="Gray" FontSize="30" HorizontalAlignment="Left" />
                                <TextBlock Text=" " />
                                <TextBlock Text="{ Binding Value}" Style="{StaticResource PanoramaTextBlock}" FontSize="30" HorizontalAlignment="Right" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>

            <controls:PivotItem Header="news" Foreground="White">
                <Grid>
                    <ListBox x:Name="lboNews" HorizontalAlignment="Left" Width="400" SelectionChanged="lboNews_SelectionChanged" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{ Binding Published}" Style="{StaticResource PanoramaTextBlock}" Foreground="Gray" FontSize="25" Margin="0,0,0,0" />
                                    <TextBlock Text="{ Binding Title}" TextWrapping="Wrap" FontSize="30" Style="{StaticResource PanoramaTextBlock}" Margin="0,-10,0,30" />
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <TextBlock x:Name="lblLoading" Text="loading..." FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    <Button x:Name="btnCommand" Width="0" Height="0" Click="btnCommand_Click"  HorizontalAlignment="Right" VerticalAlignment="Top" />
                </Grid>
            </controls:PivotItem>

            <controls:PivotItem Header="chart" Foreground="White">
                <charting:Chart x:Name="Chart1" Width="597" Height="550" VerticalAlignment="Top" Background="Transparent" >
                    <charting:Chart.Series>
                        <charting:LineSeries ItemsSource="{Binding}" 
                        DependentValueBinding="{Binding Close}" 
                        IndependentValueBinding="{Binding Date}" >

                            <charting:LineSeries.DataPointStyle>
                                <Style TargetType="Control">
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                </Style>
                            </charting:LineSeries.DataPointStyle>
                        </charting:LineSeries>

                    </charting:Chart.Series>
                </charting:Chart>
            </controls:PivotItem>
            
        </controls:Pivot>

        <Image Source="Images/appbar_back.png" x:Name="btnBack" Width="48" Height="48" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="15,15,0,0" MouseLeftButtonDown="btnBack_MouseLeftButtonDown" />
        <TextBlock x:Name="lblHeader" Text="" FontSize="40" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="80,6,0,0" />
    </Grid>

</phone:PhoneApplicationPage>